<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link href="/crm/jquery/bootstrap_3.3.0/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/crm/jquery/jquery-1.11.1-min.js"></script>
<script type="text/javascript" src="/crm/jquery/bootstrap_3.3.0/js/bootstrap.min.js"></script>
<script src="/crm/jquery/layer_v3.1.1/layer.js"></script>
</head>
<body>
<div style="position: absolute; top: 0px; left: 0px; width: 60%;">
	<img src="image/IMG_7114.JPG" style="width: 100%; position: relative; top: 50px;">
</div>
<div id="top" style="height: 50px; background-color: #3C3C3C; width: 100%;">
	<div style="position: absolute; top: 5px; left: 0px; font-size: 30px; font-weight: 400; color: white; font-family: 'times new roman'">CRM &nbsp;<span style="font-size: 12px;">&copy;2020&nbsp;南京艾瑞</span></div>
</div>

<div style="position: absolute; top: 120px; right: 100px;width:450px;height:400px;border:1px solid #D5D5D5">
	<div style="position: absolute; top: 0px; right: 60px;">
		<div class="page-header">
			<h1>登录</h1>
		</div>
		<form action="workbench/index.html" class="form-horizontal" role="form">
			<div class="form-group form-group-lg">
				<div style="width: 350px;">
					<input id="loginAct" class="form-control" type="text" placeholder="用户名">
				</div>
				<div style="width: 350px; position: relative;top: 20px;">
					<input id="loginPwd" class="form-control" type="password" placeholder="密码">
				</div>
				<div class="checkbox"  style="position: relative;top: 30px; left: 10px;">
					<span id="msg"></span>
				</div>
				<button type="button" onclick="login()" class="btn btn-primary btn-lg btn-block"  style="width: 350px; position: relative;top: 45px;">登录</button>
			</div>
		</form>
	</div>
</div>
</body>
</html>
<script>
	if(window != this.top){
		top.location.href = "/crm/toLogin";
	}
	//按下回车键登录
	document.body.onkeypress = function (event){
		if(event.code == 'Enter'){
			//完成登录
			login();
		}
	}
	//点击登录按钮完成登录
	function login(){
		$.post('/crm/user/login',{
			'loginAct' : $('#loginAct').val(),
			'loginPwd' : $('#loginPwd').val(),
		},function (data){
			if(!data.ok){
				layer.open({
					title: '消息提示'
					,content: data.message,
					icon : 5
				});
			}else{
				//跳转到后台首页
				location.href = "/crm/toView/workbench/index";
			}
		},'json');
	}
</script>